package at.jku.ase.utils;

/**
 * Created by IntelliJ IDEA.
 * User: stellit
 * Date: 12/18/11
 * Time: 9:13 PM
 * To change this template use File | Settings | File Templates.
 */
public abstract class OpThrowsException {

    public abstract void op() throws Exception;

    public void execute() {
        try {
            op();
        } catch (Exception e) {
            try {
                cleanUp();
            } catch (Exception e1) {
                throw new RuntimeException("Exception when cleaning up");
            }
            throw new RuntimeException(e);
        }
    }
    
    public void cleanUp() throws Exception {
    }

}
